﻿// -----------------------------------------------------------------------
// <copyright file="MovementEstimator.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace JumpJump.AI
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using JumpJump.Runtime;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class MovementEstimator
    {
        public static int[,] GoodPositionRangeYX = new int[18, 2] 
        {
            { -1, -1 },
            { 5, 5 }, 
            { 5, 6 },
            { 5, 7 },
            { 5, 8 },
            { 5, 13 },
            { 5, 13 },
            { 5, 13 },
            { 5, 13 },
            { 6, 13 },
            { 7, 13 },
            { 8, 13 },
            { 8, 13 },
            { 10, 13 },
            { 10, 13 },
            { 11, 13 },
            { 12, 13 },
            { 13, 13 },
        };

        public MovementEstimator()
        {
            
        }

        public static bool IsAGoodMove(Movement move)
        {
            if (move.Target.Y > move.From.Y)
            {
                return false;
            }

            int x = move.Target.X;
            int y = move.Target.Y;
            if (x > MovementEstimator.GoodPositionRangeYX[y, 1] || x < MovementEstimator.GoodPositionRangeYX[y, 0])
            {
                return false;
            }

            return true;
        }

        public static int Estimate(Movement oneMove)
        {
            int depth = Math.Abs(oneMove.Target.Y - oneMove.From.Y);
            return depth * 100;
        }
    }
}
